$("#btn_modify").click(function () {

    var seqs=$("[name='seqs']");
    var displays=$("[name='displays']");

    if($(this).text()=="编辑顺序与显示状态"){
        $(this).text("保存编辑");
        $(seqs).each(function (index,item) {
            $(item).removeAttr("readonly");
        });
        $(displays).each(function (index,item) {
            $(item).removeAttr("disabled");
        })
    }else{
        var model_path = $("#form1").attr("model_path");
        var ids=$("[name='ids']");
        var ids_array=new Array();
        $(ids).each(function (index,item) {
            ids_array.push($(item).val())
        })
        var seqs=$("[name='seqs']");
        var seqs_array=new Array();
        $(seqs).each(function (index,item) {
            seqs_array.push($(item).val())
        })
        var displays=$("[name='displays']");
        var displays_array=new Array();
        $(displays).each(function (index,item) {
            displays_array.push($(item).val())
        })

        $.ajax({
            type: "POST",
            url: model_path+"/modifysSeqAndDisplay",
            data: {ids:ids_array,seqs:seqs_array,displays:displays_array},
            traditional:true,
            success: function(result){
               if(result)
                   alert("批量更新成功！");
               else
                   alert("批量更新失败！");
            }
        });

        $(this).text("编辑顺序与显示状态");
        $(seqs).each(function (index,item) {
            $(item).attr("readonly","readonly");
        });
        $(displays).each(function (index,item) {
            $(item).attr("disabled","disabled");
        })
    }


})